// pages/article/article.js
Page({
  data:{
    id:'',
    title:'',
    content:''
  },
  onLoad:function(options){
    // 页面初始化 options为页面跳转所带来的参数
    var that = this;
    this.setData({
      id:options.id,
      title:options.title
    }); 
    wx.showLoading({
      title:"加载中"
    });
    wx.showNavigationBarLoading();
    wx.request({
      url: 'http://shop.heimicms.com/app/cms/article_content',
      data: {id:options.id},
      header: {'content-type': 'application/json'}, // 设置请求的 header
      success: function(res){
        that.setData({
          content:res.data.data.content
        }); 
        wx.setNavigationBarTitle({
          title: that.data.title
        })       
      },
      fail: function(res) {
        
      },
      complete: function(res) {
        wx.hideLoading();
        wx.hideNavigationBarLoading();
      }
    })
  },
  onReady:function(){
    // 页面渲染完成
  },
  onShow:function(){
    // 页面显示
  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  }
})